<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<div class="page-header">
	<h1>Users</h1>
</div>

<form:form method="post" commandName="userListCommand">
	<div class="scroll">
	<table class="table table-striped table-condensed">
		<thead>
			<tr>
				<th width="10px"></th>
				<th>email</th>
				<th>Name</th>
				<th width="75px" colspan="2"></th>
			</tr>
		</thead>
		<c:forEach var="user" items="${userListCommand.userList}"
			varStatus="iterator">
			<tr <c:if test="${!user.enabled}">class="blocked-user"</c:if>>
				<td><form:checkbox path="userList[${iterator.index}].selected" />
					<form:hidden path="userList[${iterator.index}].id" /></td>
				<td><a href="<c:url value='/admin/user/edit/${user.id}'/>">${user.email}</a>
				</td>
				<td>${user.name}</td>
				<td>
					<span class="badge badge-info pointerCursor"
						onclick="location.href='<c:url value='/admin/user/duplicate/${user.id}'/>'"
						title="Duplicate user">
						<i class="icon-user icon-white"></i>
						<i class="icon-user icon-white"></i>
					</span>
			    </td>
				<td>
					<c:if test="${user.enabled}">
						<span class="badge badge-info pointerCursor"
							onclick="location.href='<c:url value='/admin/user/ban/${user.id}'/>'"
							title="Disable user">
							<i class="icon-ban-circle icon-white"></i>
						</span>
					</c:if>
					<c:if test="${!user.enabled}">
						<span class="badge badge-info pointerCursor"
							onclick="location.href='<c:url value='/admin/user/unban/${user.id}'/>'"
							title="Enable user">
							<i class="icon-ban-circle"></i>
						</span>
					</c:if>
				</td>
			</tr>
		</c:forEach>
	</table>
	</div>
</form:form>

<script type="text/javascript">
	setActiveMainMenuElem('administration');
	$('#menuAllUsers').addClass('active');
</script>